<?php

	function checkResult($result){
		if(!$result){
	    		die();
		}
	}

	if ($_SERVER['REQUEST_METHOD'] == 'GET') {
	
		mysql_connect("localhost","akosciak","MojaPtaszek");
		
		mysql_select_db("songbump") or die( "Unable to select database");
		
		$query = "DELETE FROM Edges";
		$result = mysql_query($query);
		checkResult($result);
		$query = "DELETE FROM GroupMembers";
		$result = mysql_query($query);
		checkResult($result);
		$query = "DELETE FROM Songs";
		$result = mysql_query($query);
		checkResult($result);
		$query = "DELETE FROM SongsPlayed";
		$result = mysql_query($query);
		checkResult($result);
		$query = "DELETE FROM Groups";
		$result = mysql_query($query);
		checkResult($result);
		$query = "DELETE FROM Users";
		$result = mysql_query($query);
		checkResult($result);
	}
	
?>
